package leetcode.L500;

public class EX48 {
    public static void main(String[] args) {
        int[][] matrix = {
                {1, 2, 3},
                {4, 5, 6},
                {7, 8, 9}};

        int n = matrix.length;
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                //置换两次置换回来了
                int te = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = te;
            }
        }

        for(int i=0;i<n/2;i++){
            for(int j=0;j<n;j++){
                int te = matrix[j][i];
                matrix[j][i] = matrix[j][n-1-i];
                matrix[j][n-1-i] = te;
            }
        }
    }
}
